<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>entries.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="closure_goog_tweak_entries.js.html">entries.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2009 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>/**
<a name="line16"></a> * @fileoverview Definitions for all tweak entries.
<a name="line17"></a> * The class hierarchy is as follows (abstract entries are denoted with a *):
<a name="line18"></a> * BaseEntry(id, description) *
<a name="line19"></a> *   -&gt; ButtonAction(buttons in the UI)
<a name="line20"></a> *   -&gt; BaseSetting(query parameter) *
<a name="line21"></a> *     -&gt; BooleanGroup(child booleans)
<a name="line22"></a> *     -&gt; BasePrimitiveSetting(value, defaultValue) *
<a name="line23"></a> *       -&gt; BooleanSetting
<a name="line24"></a> *       -&gt; StringSetting
<a name="line25"></a> *       -&gt; NumericSetting
<a name="line26"></a> *       -&gt; BooleanInGroupSetting(token)
<a name="line27"></a> * Most clients should not use these classes directly, but instead use the API
<a name="line28"></a> * defined in tweak.js. One possible use case for directly using them is to
<a name="line29"></a> * register tweaks that are not known at compile time.
<a name="line30"></a> *
<a name="line31"></a> * @author agrieve@google.com (Andrew Grieve)
<a name="line32"></a> */
<a name="line33"></a>
<a name="line34"></a>goog.provide(&#39;goog.tweak.BaseEntry&#39;);
<a name="line35"></a>goog.provide(&#39;goog.tweak.BasePrimitiveSetting&#39;);
<a name="line36"></a>goog.provide(&#39;goog.tweak.BaseSetting&#39;);
<a name="line37"></a>goog.provide(&#39;goog.tweak.BooleanGroup&#39;);
<a name="line38"></a>goog.provide(&#39;goog.tweak.BooleanInGroupSetting&#39;);
<a name="line39"></a>goog.provide(&#39;goog.tweak.BooleanSetting&#39;);
<a name="line40"></a>goog.provide(&#39;goog.tweak.ButtonAction&#39;);
<a name="line41"></a>goog.provide(&#39;goog.tweak.NumericSetting&#39;);
<a name="line42"></a>goog.provide(&#39;goog.tweak.StringSetting&#39;);
<a name="line43"></a>
<a name="line44"></a>goog.require(&#39;goog.array&#39;);
<a name="line45"></a>goog.require(&#39;goog.asserts&#39;);
<a name="line46"></a>goog.require(&#39;goog.debug.Logger&#39;);
<a name="line47"></a>goog.require(&#39;goog.object&#39;);
<a name="line48"></a>
<a name="line49"></a>
<a name="line50"></a>
<a name="line51"></a>/**
<a name="line52"></a> * Base class for all Registry entries.
<a name="line53"></a> * @param {string} id The ID for the entry. Must contain only letters,
<a name="line54"></a> *     numbers, underscores and periods.
<a name="line55"></a> * @param {string} description A description of what the entry does.
<a name="line56"></a> * @constructor
<a name="line57"></a> */
<a name="line58"></a>goog.tweak.BaseEntry = function(id, description) {
<a name="line59"></a>  /**
<a name="line60"></a>   * An ID to uniquely identify the entry.
<a name="line61"></a>   * @type {string}
<a name="line62"></a>   * @private
<a name="line63"></a>   */
<a name="line64"></a>  this.id_ = id;
<a name="line65"></a>
<a name="line66"></a>  /**
<a name="line67"></a>   * A descriptive label for the entry.
<a name="line68"></a>   * @type {string}
<a name="line69"></a>   */
<a name="line70"></a>  this.label = id;
<a name="line71"></a>
<a name="line72"></a>  /**
<a name="line73"></a>   * A description of what this entry does.
<a name="line74"></a>   * @type {string}
<a name="line75"></a>   */
<a name="line76"></a>  this.description = description;
<a name="line77"></a>
<a name="line78"></a>  /**
<a name="line79"></a>   * Functions to be called whenever a setting is changed or a button is
<a name="line80"></a>   * clicked.
<a name="line81"></a>   * @type {!Array.&lt;!Function&gt;}
<a name="line82"></a>   * @private
<a name="line83"></a>   */
<a name="line84"></a>  this.callbacks_ = [];
<a name="line85"></a>};
<a name="line86"></a>
<a name="line87"></a>
<a name="line88"></a>/**
<a name="line89"></a> * The logger for this class.
<a name="line90"></a> * @type {!goog.debug.Logger}
<a name="line91"></a> * @protected
<a name="line92"></a> */
<a name="line93"></a>goog.tweak.BaseEntry.prototype.logger =
<a name="line94"></a>    goog.debug.Logger.getLogger(&#39;goog.tweak.BaseEntry&#39;);
<a name="line95"></a>
<a name="line96"></a>
<a name="line97"></a>/**
<a name="line98"></a> * Whether a restart is required for changes to the setting to take effect.
<a name="line99"></a> * @type {boolean}
<a name="line100"></a> * @private
<a name="line101"></a> */
<a name="line102"></a>goog.tweak.BaseEntry.prototype.restartRequired_ = true;
<a name="line103"></a>
<a name="line104"></a>
<a name="line105"></a>/**
<a name="line106"></a> * @return {string} Returns the entry&#39;s ID.
<a name="line107"></a> */
<a name="line108"></a>goog.tweak.BaseEntry.prototype.getId = function() {
<a name="line109"></a>  return this.id_;
<a name="line110"></a>};
<a name="line111"></a>
<a name="line112"></a>
<a name="line113"></a>/**
<a name="line114"></a> * Returns whether a restart is required for changes to the setting to take
<a name="line115"></a> * effect.
<a name="line116"></a> * @return {boolean} The value.
<a name="line117"></a> */
<a name="line118"></a>goog.tweak.BaseEntry.prototype.isRestartRequired = function() {
<a name="line119"></a>  return this.restartRequired_;
<a name="line120"></a>};
<a name="line121"></a>
<a name="line122"></a>
<a name="line123"></a>/**
<a name="line124"></a> * Sets whether a restart is required for changes to the setting to take
<a name="line125"></a> * effect.
<a name="line126"></a> * @param {boolean} value The new value.
<a name="line127"></a> */
<a name="line128"></a>goog.tweak.BaseEntry.prototype.setRestartRequired = function(value) {
<a name="line129"></a>  this.restartRequired_ = value;
<a name="line130"></a>};
<a name="line131"></a>
<a name="line132"></a>
<a name="line133"></a>/**
<a name="line134"></a> * Adds a callback that should be called when the setting has changed (or when
<a name="line135"></a> * an action has been clicked).
<a name="line136"></a> * @param {!Function} callback The callback to add.
<a name="line137"></a> */
<a name="line138"></a>goog.tweak.BaseEntry.prototype.addCallback = function(callback) {
<a name="line139"></a>  this.callbacks_.push(callback);
<a name="line140"></a>};
<a name="line141"></a>
<a name="line142"></a>
<a name="line143"></a>/**
<a name="line144"></a> * Removes a callback that was added by addCallback.
<a name="line145"></a> * @param {!Function} callback The callback to add.
<a name="line146"></a> */
<a name="line147"></a>goog.tweak.BaseEntry.prototype.removeCallback = function(callback) {
<a name="line148"></a>  goog.array.remove(this.callbacks_, callback);
<a name="line149"></a>};
<a name="line150"></a>
<a name="line151"></a>
<a name="line152"></a>/**
<a name="line153"></a> * Calls all registered callbacks.
<a name="line154"></a> */
<a name="line155"></a>goog.tweak.BaseEntry.prototype.fireCallbacks = function() {
<a name="line156"></a>  for (var i = 0, callback; callback = this.callbacks_[i]; ++i) {
<a name="line157"></a>    callback(this);
<a name="line158"></a>  }
<a name="line159"></a>};
<a name="line160"></a>
<a name="line161"></a>
<a name="line162"></a>
<a name="line163"></a>/**
<a name="line164"></a> * Base class for all tweak entries that are settings. Settings are entries
<a name="line165"></a> * that are associated with a query parameter.
<a name="line166"></a> * @param {string} id The ID for the setting.
<a name="line167"></a> * @param {string} description A description of what the setting does.
<a name="line168"></a> * @constructor
<a name="line169"></a> * @extends {goog.tweak.BaseEntry}
<a name="line170"></a> */
<a name="line171"></a>goog.tweak.BaseSetting = function(id, description) {
<a name="line172"></a>  goog.tweak.BaseEntry.call(this, id, description);
<a name="line173"></a>  // Apply this restriction for settings since they turn in to query
<a name="line174"></a>  // parameters. For buttons, it&#39;s not really important.
<a name="line175"></a>  goog.asserts.assert(!/[^A-Za-z0-9._]/.test(id),
<a name="line176"></a>      &#39;Tweak id contains illegal characters: &#39;, id);
<a name="line177"></a>
<a name="line178"></a>  /**
<a name="line179"></a>   * The value of this setting&#39;s query parameter.
<a name="line180"></a>   * @type {string|undefined}
<a name="line181"></a>   * @protected
<a name="line182"></a>   */
<a name="line183"></a>  this.initialQueryParamValue;
<a name="line184"></a>
<a name="line185"></a>  /**
<a name="line186"></a>   * The query parameter that controls this setting.
<a name="line187"></a>   * @type {?string}
<a name="line188"></a>   * @private
<a name="line189"></a>   */
<a name="line190"></a>  this.paramName_ = this.getId().toLowerCase();
<a name="line191"></a>};
<a name="line192"></a>goog.inherits(goog.tweak.BaseSetting, goog.tweak.BaseEntry);
<a name="line193"></a>
<a name="line194"></a>
<a name="line195"></a>/**
<a name="line196"></a> * States of initialization. Entries are initialized lazily in order to allow
<a name="line197"></a> * their initialization to happen in multiple statements.
<a name="line198"></a> * @enum {number}
<a name="line199"></a> * @private
<a name="line200"></a> */
<a name="line201"></a>goog.tweak.BaseSetting.InitializeState_ = {
<a name="line202"></a>  // The start state for all settings.
<a name="line203"></a>  NOT_INITIALIZED: 0,
<a name="line204"></a>  // This is used to allow concrete classes to call assertNotInitialized()
<a name="line205"></a>  // during their initialize() function.
<a name="line206"></a>  INITIALIZING: 1,
<a name="line207"></a>  // One a setting is initialized, it may no longer change its configuration
<a name="line208"></a>  // settings (associated query parameter, token, etc).
<a name="line209"></a>  INITIALIZED: 2
<a name="line210"></a>};
<a name="line211"></a>
<a name="line212"></a>
<a name="line213"></a>/**
<a name="line214"></a> * The logger for this class.
<a name="line215"></a> * @type {!goog.debug.Logger}
<a name="line216"></a> * @protected
<a name="line217"></a> * @override
<a name="line218"></a> */
<a name="line219"></a>goog.tweak.BaseSetting.prototype.logger =
<a name="line220"></a>    goog.debug.Logger.getLogger(&#39;goog.tweak.BaseSetting&#39;);
<a name="line221"></a>
<a name="line222"></a>
<a name="line223"></a>/**
<a name="line224"></a> * Whether initialize() has been called (or is in the middle of being called).
<a name="line225"></a> * @type {goog.tweak.BaseSetting.InitializeState_}
<a name="line226"></a> * @private
<a name="line227"></a> */
<a name="line228"></a>goog.tweak.BaseSetting.prototype.initializeState_ =
<a name="line229"></a>    goog.tweak.BaseSetting.InitializeState_.NOT_INITIALIZED;
<a name="line230"></a>
<a name="line231"></a>
<a name="line232"></a>/**
<a name="line233"></a> * Sets the value of the entry based on the value of the query parameter. Once
<a name="line234"></a> * this is called, configuration settings (associated query parameter, token,
<a name="line235"></a> * etc) may not be changed.
<a name="line236"></a> * @param {?string} value The part of the query param for this setting after
<a name="line237"></a> *     the &#39;=&#39;. Null if it is not present.
<a name="line238"></a> * @protected
<a name="line239"></a> */
<a name="line240"></a>goog.tweak.BaseSetting.prototype.initialize = goog.abstractMethod;
<a name="line241"></a>
<a name="line242"></a>
<a name="line243"></a>/**
<a name="line244"></a> * Returns the value to be used in the query parameter for this tweak.
<a name="line245"></a> * @return {?string} The encoded value. Null if the value is set to its
<a name="line246"></a> *     default.
<a name="line247"></a> */
<a name="line248"></a>goog.tweak.BaseSetting.prototype.getNewValueEncoded = goog.abstractMethod;
<a name="line249"></a>
<a name="line250"></a>
<a name="line251"></a>/**
<a name="line252"></a> * Asserts that this tweak has not been initialized yet.
<a name="line253"></a> * @param {string} funcName Function name to use in the assertion message.
<a name="line254"></a> * @protected
<a name="line255"></a> */
<a name="line256"></a>goog.tweak.BaseSetting.prototype.assertNotInitialized = function(funcName) {
<a name="line257"></a>  goog.asserts.assert(this.initializeState_ !=
<a name="line258"></a>      goog.tweak.BaseSetting.InitializeState_.INITIALIZED,
<a name="line259"></a>      &#39;Cannot call &#39; + funcName + &#39; after the tweak as been initialized.&#39;);
<a name="line260"></a>};
<a name="line261"></a>
<a name="line262"></a>
<a name="line263"></a>/**
<a name="line264"></a> * Returns whether the setting is currently being initialized.
<a name="line265"></a> * @return {boolean} Whether the setting is currently being initialized.
<a name="line266"></a> * @protected
<a name="line267"></a> */
<a name="line268"></a>goog.tweak.BaseSetting.prototype.isInitializing = function() {
<a name="line269"></a>  return this.initializeState_ ==
<a name="line270"></a>      goog.tweak.BaseSetting.InitializeState_.INITIALIZING;
<a name="line271"></a>};
<a name="line272"></a>
<a name="line273"></a>
<a name="line274"></a>/**
<a name="line275"></a> * Sets the initial query parameter value for this setting. May not be called
<a name="line276"></a> * after the setting has been initialized.
<a name="line277"></a> * @param {string} value The inital query parameter value for this setting.
<a name="line278"></a> */
<a name="line279"></a>goog.tweak.BaseSetting.prototype.setInitialQueryParamValue = function(value) {
<a name="line280"></a>  this.assertNotInitialized(&#39;setInitialQueryParamValue&#39;);
<a name="line281"></a>  this.initialQueryParamValue = value;
<a name="line282"></a>};
<a name="line283"></a>
<a name="line284"></a>
<a name="line285"></a>/**
<a name="line286"></a> * Returns the name of the query parameter used for this setting.
<a name="line287"></a> * @return {?string} The param name. Null if no query parameter is directly
<a name="line288"></a> *     associated with the setting.
<a name="line289"></a> */
<a name="line290"></a>goog.tweak.BaseSetting.prototype.getParamName = function() {
<a name="line291"></a>  return this.paramName_;
<a name="line292"></a>};
<a name="line293"></a>
<a name="line294"></a>
<a name="line295"></a>/**
<a name="line296"></a> * Sets the name of the query parameter used for this setting. If null is
<a name="line297"></a> * passed the the setting will not appear in the top-level query string.
<a name="line298"></a> * @param {?string} value The new value.
<a name="line299"></a> */
<a name="line300"></a>goog.tweak.BaseSetting.prototype.setParamName = function(value) {
<a name="line301"></a>  this.assertNotInitialized(&#39;setParamName&#39;);
<a name="line302"></a>  this.paramName_ = value;
<a name="line303"></a>};
<a name="line304"></a>
<a name="line305"></a>
<a name="line306"></a>/**
<a name="line307"></a> * Applies the default value or query param value if this is the first time
<a name="line308"></a> * that the function has been called.
<a name="line309"></a> * @protected
<a name="line310"></a> */
<a name="line311"></a>goog.tweak.BaseSetting.prototype.ensureInitialized = function() {
<a name="line312"></a>  if (this.initializeState_ ==
<a name="line313"></a>      goog.tweak.BaseSetting.InitializeState_.NOT_INITIALIZED) {
<a name="line314"></a>    // Instead of having only initialized / not initialized, there is a
<a name="line315"></a>    // separate in-between state so that functions that call
<a name="line316"></a>    // assertNotInitialized() will not fail when called inside of the
<a name="line317"></a>    // initialize().
<a name="line318"></a>    this.initializeState_ =
<a name="line319"></a>        goog.tweak.BaseSetting.InitializeState_.INITIALIZING;
<a name="line320"></a>    var value = this.initialQueryParamValue == undefined ? null :
<a name="line321"></a>        this.initialQueryParamValue;
<a name="line322"></a>    this.initialize(value);
<a name="line323"></a>    this.initializeState_ =
<a name="line324"></a>        goog.tweak.BaseSetting.InitializeState_.INITIALIZED;
<a name="line325"></a>  }
<a name="line326"></a>};
<a name="line327"></a>
<a name="line328"></a>
<a name="line329"></a>
<a name="line330"></a>/**
<a name="line331"></a> * Base class for all settings that wrap primitive values.
<a name="line332"></a> * @param {string} id The ID for the setting.
<a name="line333"></a> * @param {string} description A description of what the setting does.
<a name="line334"></a> * @param {*} defaultValue The default value for this setting.
<a name="line335"></a> * @constructor
<a name="line336"></a> * @extends {goog.tweak.BaseSetting}
<a name="line337"></a> */
<a name="line338"></a>goog.tweak.BasePrimitiveSetting = function(id, description, defaultValue) {
<a name="line339"></a>  goog.tweak.BaseSetting.call(this, id, description);
<a name="line340"></a>  /**
<a name="line341"></a>   * The default value of the setting.
<a name="line342"></a>   * @type {*}
<a name="line343"></a>   * @private
<a name="line344"></a>   */
<a name="line345"></a>  this.defaultValue_ = defaultValue;
<a name="line346"></a>
<a name="line347"></a>  /**
<a name="line348"></a>   * The value of the tweak.
<a name="line349"></a>   * @type {*}
<a name="line350"></a>   * @private
<a name="line351"></a>   */
<a name="line352"></a>  this.value_;
<a name="line353"></a>
<a name="line354"></a>  /**
<a name="line355"></a>   * The value of the tweak once &quot;Apply Tweaks&quot; is pressed.
<a name="line356"></a>   * @type {*}
<a name="line357"></a>   * @private
<a name="line358"></a>   */
<a name="line359"></a>  this.newValue_;
<a name="line360"></a>};
<a name="line361"></a>goog.inherits(goog.tweak.BasePrimitiveSetting, goog.tweak.BaseSetting);
<a name="line362"></a>
<a name="line363"></a>
<a name="line364"></a>/**
<a name="line365"></a> * The logger for this class.
<a name="line366"></a> * @type {!goog.debug.Logger}
<a name="line367"></a> * @protected
<a name="line368"></a> * @override
<a name="line369"></a> */
<a name="line370"></a>goog.tweak.BasePrimitiveSetting.prototype.logger =
<a name="line371"></a>    goog.debug.Logger.getLogger(&#39;goog.tweak.BasePrimitiveSetting&#39;);
<a name="line372"></a>
<a name="line373"></a>
<a name="line374"></a>/**
<a name="line375"></a> * Returns the query param encoded representation of the setting&#39;s value.
<a name="line376"></a> * @return {string} The encoded value.
<a name="line377"></a> * @protected
<a name="line378"></a> */
<a name="line379"></a>goog.tweak.BasePrimitiveSetting.prototype.encodeNewValue =
<a name="line380"></a>    goog.abstractMethod;
<a name="line381"></a>
<a name="line382"></a>
<a name="line383"></a>/**
<a name="line384"></a> * If the setting has the restartRequired option, then returns its inital
<a name="line385"></a> * value. Otherwise, returns its current value.
<a name="line386"></a> * @return {*} The value.
<a name="line387"></a> */
<a name="line388"></a>goog.tweak.BasePrimitiveSetting.prototype.getValue = function() {
<a name="line389"></a>  this.ensureInitialized();
<a name="line390"></a>  return this.value_;
<a name="line391"></a>};
<a name="line392"></a>
<a name="line393"></a>
<a name="line394"></a>/**
<a name="line395"></a> * Returns the value of the setting to use once &quot;Apply Tweaks&quot; is clicked.
<a name="line396"></a> * @return {*} The value.
<a name="line397"></a> */
<a name="line398"></a>goog.tweak.BasePrimitiveSetting.prototype.getNewValue = function() {
<a name="line399"></a>  this.ensureInitialized();
<a name="line400"></a>  return this.newValue_;
<a name="line401"></a>};
<a name="line402"></a>
<a name="line403"></a>
<a name="line404"></a>/**
<a name="line405"></a> * Sets the value of the setting. If the setting has the restartRequired
<a name="line406"></a> * option, then the value will not be changed until the &quot;Apply Tweaks&quot; button
<a name="line407"></a> * is clicked. If it does not have the option, the value will be update
<a name="line408"></a> * immediately and all registered callbacks will be called.
<a name="line409"></a> * @param {*} value The value.
<a name="line410"></a> */
<a name="line411"></a>goog.tweak.BasePrimitiveSetting.prototype.setValue = function(value) {
<a name="line412"></a>  this.ensureInitialized();
<a name="line413"></a>  var changed = this.newValue_ != value;
<a name="line414"></a>  this.newValue_ = value;
<a name="line415"></a>  // Don&#39;t fire callbacks if we are currently in the initialize() method.
<a name="line416"></a>  if (this.isInitializing()) {
<a name="line417"></a>    this.value_ = value;
<a name="line418"></a>  } else {
<a name="line419"></a>    if (!this.isRestartRequired()) {
<a name="line420"></a>      // Update the current value only if the tweak has been marked as not
<a name="line421"></a>      // needing a restart.
<a name="line422"></a>      this.value_ = value;
<a name="line423"></a>    }
<a name="line424"></a>    if (changed) {
<a name="line425"></a>      this.fireCallbacks();
<a name="line426"></a>    }
<a name="line427"></a>  }
<a name="line428"></a>};
<a name="line429"></a>
<a name="line430"></a>
<a name="line431"></a>/**
<a name="line432"></a> * Returns the default value for this setting.
<a name="line433"></a> * @return {*} The default value.
<a name="line434"></a> */
<a name="line435"></a>goog.tweak.BasePrimitiveSetting.prototype.getDefaultValue = function() {
<a name="line436"></a>  return this.defaultValue_;
<a name="line437"></a>};
<a name="line438"></a>
<a name="line439"></a>
<a name="line440"></a>/**
<a name="line441"></a> * Sets the default value for the tweak.
<a name="line442"></a> * @param {*} value The new value.
<a name="line443"></a> */
<a name="line444"></a>goog.tweak.BasePrimitiveSetting.prototype.setDefaultValue =
<a name="line445"></a>    function(value) {
<a name="line446"></a>  this.assertNotInitialized(&#39;setDefaultValue&#39;);
<a name="line447"></a>  this.defaultValue_ = value;
<a name="line448"></a>};
<a name="line449"></a>
<a name="line450"></a>
<a name="line451"></a>/**
<a name="line452"></a> * @override
<a name="line453"></a> */
<a name="line454"></a>goog.tweak.BasePrimitiveSetting.prototype.getNewValueEncoded = function() {
<a name="line455"></a>  this.ensureInitialized();
<a name="line456"></a>  return this.newValue_ == this.defaultValue_ ? null : this.encodeNewValue();
<a name="line457"></a>};
<a name="line458"></a>
<a name="line459"></a>
<a name="line460"></a>
<a name="line461"></a>/**
<a name="line462"></a> * A registry setting for string values.
<a name="line463"></a> * @param {string} id The ID for the setting.
<a name="line464"></a> * @param {string} description A description of what the setting does.
<a name="line465"></a> * @constructor
<a name="line466"></a> * @extends {goog.tweak.BasePrimitiveSetting}
<a name="line467"></a> */
<a name="line468"></a>goog.tweak.StringSetting = function(id, description) {
<a name="line469"></a>  goog.tweak.BasePrimitiveSetting.call(this, id, description, &#39;&#39;);
<a name="line470"></a>  /**
<a name="line471"></a>   * Valid values for the setting.
<a name="line472"></a>   * @type {Array.&lt;string&gt;|undefined}
<a name="line473"></a>   */
<a name="line474"></a>  this.validValues_;
<a name="line475"></a>};
<a name="line476"></a>goog.inherits(goog.tweak.StringSetting, goog.tweak.BasePrimitiveSetting);
<a name="line477"></a>
<a name="line478"></a>
<a name="line479"></a>/**
<a name="line480"></a> * The logger for this class.
<a name="line481"></a> * @type {!goog.debug.Logger}
<a name="line482"></a> * @protected
<a name="line483"></a> * @override
<a name="line484"></a> */
<a name="line485"></a>goog.tweak.StringSetting.prototype.logger =
<a name="line486"></a>    goog.debug.Logger.getLogger(&#39;goog.tweak.StringSetting&#39;);
<a name="line487"></a>
<a name="line488"></a>
<a name="line489"></a>/**
<a name="line490"></a> * @override
<a name="line491"></a> * @return {string} The tweaks&#39;s value.
<a name="line492"></a> */
<a name="line493"></a>goog.tweak.StringSetting.prototype.getValue;
<a name="line494"></a>
<a name="line495"></a>
<a name="line496"></a>/**
<a name="line497"></a> * @override
<a name="line498"></a> * @return {string} The tweaks&#39;s new value.
<a name="line499"></a> */
<a name="line500"></a>goog.tweak.StringSetting.prototype.getNewValue;
<a name="line501"></a>
<a name="line502"></a>
<a name="line503"></a>/**
<a name="line504"></a> * @override
<a name="line505"></a> * @param {string} value The tweaks&#39;s value.
<a name="line506"></a> */
<a name="line507"></a>goog.tweak.StringSetting.prototype.setValue;
<a name="line508"></a>
<a name="line509"></a>
<a name="line510"></a>/**
<a name="line511"></a> * @override
<a name="line512"></a> * @param {string} value The default value.
<a name="line513"></a> */
<a name="line514"></a>goog.tweak.StringSetting.prototype.setDefaultValue;
<a name="line515"></a>
<a name="line516"></a>
<a name="line517"></a>/**
<a name="line518"></a> * @override
<a name="line519"></a> * @return {string} The default value.
<a name="line520"></a> */
<a name="line521"></a>goog.tweak.StringSetting.prototype.getDefaultValue;
<a name="line522"></a>
<a name="line523"></a>
<a name="line524"></a>/**
<a name="line525"></a> * @override
<a name="line526"></a> */
<a name="line527"></a>goog.tweak.StringSetting.prototype.encodeNewValue = function() {
<a name="line528"></a>  return this.getNewValue();
<a name="line529"></a>};
<a name="line530"></a>
<a name="line531"></a>
<a name="line532"></a>/**
<a name="line533"></a> * Sets the valid values for the setting.
<a name="line534"></a> * @param {Array.&lt;string&gt;|undefined} values Valid values.
<a name="line535"></a> */
<a name="line536"></a>goog.tweak.StringSetting.prototype.setValidValues = function(values) {
<a name="line537"></a>  this.assertNotInitialized(&#39;setValidValues&#39;);
<a name="line538"></a>  this.validValues_ = values;
<a name="line539"></a>  // Set the default value to the first value in the list if the current
<a name="line540"></a>  // default value is not within it.
<a name="line541"></a>  if (values &amp;&amp; !goog.array.contains(values, this.getDefaultValue())) {
<a name="line542"></a>    this.setDefaultValue(values[0]);
<a name="line543"></a>  }
<a name="line544"></a>};
<a name="line545"></a>
<a name="line546"></a>
<a name="line547"></a>/**
<a name="line548"></a> * Returns the valid values for the setting.
<a name="line549"></a> * @return {Array.&lt;string&gt;|undefined} Valid values.
<a name="line550"></a> */
<a name="line551"></a>goog.tweak.StringSetting.prototype.getValidValues = function() {
<a name="line552"></a>  return this.validValues_;
<a name="line553"></a>};
<a name="line554"></a>
<a name="line555"></a>
<a name="line556"></a>/**
<a name="line557"></a> * @override
<a name="line558"></a> */
<a name="line559"></a>goog.tweak.StringSetting.prototype.initialize = function(value) {
<a name="line560"></a>  if (value == null) {
<a name="line561"></a>    this.setValue(this.getDefaultValue());
<a name="line562"></a>  } else {
<a name="line563"></a>    var validValues = this.validValues_;
<a name="line564"></a>    if (validValues) {
<a name="line565"></a>      // Make the query parameter values case-insensitive since users might
<a name="line566"></a>      // type them by hand. Make the capitalization that is actual used come
<a name="line567"></a>      // from the list of valid values.
<a name="line568"></a>      value = value.toLowerCase();
<a name="line569"></a>      for (var i = 0, il = validValues.length; i &lt; il; ++i) {
<a name="line570"></a>        if (value == validValues[i].toLowerCase()) {
<a name="line571"></a>          this.setValue(validValues[i]);
<a name="line572"></a>          return;
<a name="line573"></a>        }
<a name="line574"></a>      }
<a name="line575"></a>      // Warn if the value is not in the list of allowed values.
<a name="line576"></a>      this.logger.warning(&#39;Tweak &#39; + this.getId() +
<a name="line577"></a>          &#39; has value outside of expected range:&#39; + value);
<a name="line578"></a>    }
<a name="line579"></a>    this.setValue(value);
<a name="line580"></a>  }
<a name="line581"></a>};
<a name="line582"></a>
<a name="line583"></a>
<a name="line584"></a>
<a name="line585"></a>/**
<a name="line586"></a> * A registry setting for numeric values.
<a name="line587"></a> * @param {string} id The ID for the setting.
<a name="line588"></a> * @param {string} description A description of what the setting does.
<a name="line589"></a> * @constructor
<a name="line590"></a> * @extends {goog.tweak.BasePrimitiveSetting}
<a name="line591"></a> */
<a name="line592"></a>goog.tweak.NumericSetting = function(id, description) {
<a name="line593"></a>  goog.tweak.BasePrimitiveSetting.call(this, id, description, 0);
<a name="line594"></a>  /**
<a name="line595"></a>   * Valid values for the setting.
<a name="line596"></a>   * @type {Array.&lt;number&gt;|undefined}
<a name="line597"></a>   */
<a name="line598"></a>  this.validValues_;
<a name="line599"></a>};
<a name="line600"></a>goog.inherits(goog.tweak.NumericSetting, goog.tweak.BasePrimitiveSetting);
<a name="line601"></a>
<a name="line602"></a>
<a name="line603"></a>/**
<a name="line604"></a> * The logger for this class.
<a name="line605"></a> * @type {!goog.debug.Logger}
<a name="line606"></a> * @protected
<a name="line607"></a> * @override
<a name="line608"></a> */
<a name="line609"></a>goog.tweak.NumericSetting.prototype.logger =
<a name="line610"></a>    goog.debug.Logger.getLogger(&#39;goog.tweak.NumericSetting&#39;);
<a name="line611"></a>
<a name="line612"></a>
<a name="line613"></a>/**
<a name="line614"></a> * @override
<a name="line615"></a> * @return {number} The tweaks&#39;s value.
<a name="line616"></a> */
<a name="line617"></a>goog.tweak.NumericSetting.prototype.getValue;
<a name="line618"></a>
<a name="line619"></a>
<a name="line620"></a>/**
<a name="line621"></a> * @override
<a name="line622"></a> * @return {number} The tweaks&#39;s new value.
<a name="line623"></a> */
<a name="line624"></a>goog.tweak.NumericSetting.prototype.getNewValue;
<a name="line625"></a>
<a name="line626"></a>
<a name="line627"></a>/**
<a name="line628"></a> * @override
<a name="line629"></a> * @param {number} value The tweaks&#39;s value.
<a name="line630"></a> */
<a name="line631"></a>goog.tweak.NumericSetting.prototype.setValue;
<a name="line632"></a>
<a name="line633"></a>
<a name="line634"></a>/**
<a name="line635"></a> * @override
<a name="line636"></a> * @param {number} value The default value.
<a name="line637"></a> */
<a name="line638"></a>goog.tweak.NumericSetting.prototype.setDefaultValue;
<a name="line639"></a>
<a name="line640"></a>
<a name="line641"></a>/**
<a name="line642"></a> * @override
<a name="line643"></a> * @return {number} The default value.
<a name="line644"></a> */
<a name="line645"></a>goog.tweak.NumericSetting.prototype.getDefaultValue;
<a name="line646"></a>
<a name="line647"></a>
<a name="line648"></a>/**
<a name="line649"></a> * @override
<a name="line650"></a> */
<a name="line651"></a>goog.tweak.NumericSetting.prototype.encodeNewValue = function() {
<a name="line652"></a>  return &#39;&#39; + this.getNewValue();
<a name="line653"></a>};
<a name="line654"></a>
<a name="line655"></a>
<a name="line656"></a>/**
<a name="line657"></a> * Sets the valid values for the setting.
<a name="line658"></a> * @param {Array.&lt;number&gt;|undefined} values Valid values.
<a name="line659"></a> */
<a name="line660"></a>goog.tweak.NumericSetting.prototype.setValidValues =
<a name="line661"></a>    function(values) {
<a name="line662"></a>  this.assertNotInitialized(&#39;setValidValues&#39;);
<a name="line663"></a>  this.validValues_ = values;
<a name="line664"></a>  // Set the default value to the first value in the list if the current
<a name="line665"></a>  // default value is not within it.
<a name="line666"></a>  if (values &amp;&amp; !goog.array.contains(values, this.getDefaultValue())) {
<a name="line667"></a>    this.setDefaultValue(values[0]);
<a name="line668"></a>  }
<a name="line669"></a>};
<a name="line670"></a>
<a name="line671"></a>
<a name="line672"></a>/**
<a name="line673"></a> * Returns the valid values for the setting.
<a name="line674"></a> * @return {Array.&lt;number&gt;|undefined} Valid values.
<a name="line675"></a> */
<a name="line676"></a>goog.tweak.NumericSetting.prototype.getValidValues = function() {
<a name="line677"></a>  return this.validValues_;
<a name="line678"></a>};
<a name="line679"></a>
<a name="line680"></a>
<a name="line681"></a>/**
<a name="line682"></a> * @override
<a name="line683"></a> */
<a name="line684"></a>goog.tweak.NumericSetting.prototype.initialize = function(value) {
<a name="line685"></a>  if (value == null) {
<a name="line686"></a>    this.setValue(this.getDefaultValue());
<a name="line687"></a>  } else {
<a name="line688"></a>    var coercedValue = +value;
<a name="line689"></a>    // Warn if the value is not in the list of allowed values.
<a name="line690"></a>    if (this.validValues_ &amp;&amp;
<a name="line691"></a>        !goog.array.contains(this.validValues_, coercedValue)) {
<a name="line692"></a>      this.logger.warning(&#39;Tweak &#39; + this.getId() +
<a name="line693"></a>          &#39; has value outside of expected range: &#39; + value);
<a name="line694"></a>    }
<a name="line695"></a>
<a name="line696"></a>    if (isNaN(coercedValue)) {
<a name="line697"></a>      this.logger.warning(&#39;Tweak &#39; + this.getId() +
<a name="line698"></a>          &#39; has value of NaN, resetting to &#39; + this.getDefaultValue());
<a name="line699"></a>      this.setValue(this.getDefaultValue());
<a name="line700"></a>    } else {
<a name="line701"></a>      this.setValue(coercedValue);
<a name="line702"></a>    }
<a name="line703"></a>  }
<a name="line704"></a>};
<a name="line705"></a>
<a name="line706"></a>
<a name="line707"></a>
<a name="line708"></a>/**
<a name="line709"></a> * A registry setting that can be either true of false.
<a name="line710"></a> * @param {string} id The ID for the setting.
<a name="line711"></a> * @param {string} description A description of what the setting does.
<a name="line712"></a> * @constructor
<a name="line713"></a> * @extends {goog.tweak.BasePrimitiveSetting}
<a name="line714"></a> */
<a name="line715"></a>goog.tweak.BooleanSetting = function(id, description) {
<a name="line716"></a>  goog.tweak.BasePrimitiveSetting.call(this, id, description, false);
<a name="line717"></a>};
<a name="line718"></a>goog.inherits(goog.tweak.BooleanSetting, goog.tweak.BasePrimitiveSetting);
<a name="line719"></a>
<a name="line720"></a>
<a name="line721"></a>/**
<a name="line722"></a> * The logger for this class.
<a name="line723"></a> * @type {!goog.debug.Logger}
<a name="line724"></a> * @protected
<a name="line725"></a> * @override
<a name="line726"></a> */
<a name="line727"></a>goog.tweak.BooleanSetting.prototype.logger =
<a name="line728"></a>    goog.debug.Logger.getLogger(&#39;goog.tweak.BooleanSetting&#39;);
<a name="line729"></a>
<a name="line730"></a>
<a name="line731"></a>/**
<a name="line732"></a> * @override
<a name="line733"></a> * @return {boolean} The tweaks&#39;s value.
<a name="line734"></a> */
<a name="line735"></a>goog.tweak.BooleanSetting.prototype.getValue;
<a name="line736"></a>
<a name="line737"></a>
<a name="line738"></a>/**
<a name="line739"></a> * @override
<a name="line740"></a> * @return {boolean} The tweaks&#39;s new value.
<a name="line741"></a> */
<a name="line742"></a>goog.tweak.BooleanSetting.prototype.getNewValue;
<a name="line743"></a>
<a name="line744"></a>
<a name="line745"></a>/**
<a name="line746"></a> * @override
<a name="line747"></a> * @param {boolean} value The tweaks&#39;s value.
<a name="line748"></a> */
<a name="line749"></a>goog.tweak.BooleanSetting.prototype.setValue;
<a name="line750"></a>
<a name="line751"></a>
<a name="line752"></a>/**
<a name="line753"></a> * @override
<a name="line754"></a> * @param {boolean} value The default value.
<a name="line755"></a> */
<a name="line756"></a>goog.tweak.BooleanSetting.prototype.setDefaultValue;
<a name="line757"></a>
<a name="line758"></a>
<a name="line759"></a>/**
<a name="line760"></a> * @override
<a name="line761"></a> * @return {boolean} The default value.
<a name="line762"></a> */
<a name="line763"></a>goog.tweak.BooleanSetting.prototype.getDefaultValue;
<a name="line764"></a>
<a name="line765"></a>
<a name="line766"></a>/**
<a name="line767"></a> * @override
<a name="line768"></a> */
<a name="line769"></a>goog.tweak.BooleanSetting.prototype.encodeNewValue = function() {
<a name="line770"></a>  return this.getNewValue() ? &#39;1&#39; : &#39;0&#39;;
<a name="line771"></a>};
<a name="line772"></a>
<a name="line773"></a>
<a name="line774"></a>/**
<a name="line775"></a> * @override
<a name="line776"></a> */
<a name="line777"></a>goog.tweak.BooleanSetting.prototype.initialize = function(value) {
<a name="line778"></a>  if (value == null) {
<a name="line779"></a>    this.setValue(this.getDefaultValue());
<a name="line780"></a>  } else {
<a name="line781"></a>    value = value.toLowerCase();
<a name="line782"></a>    this.setValue(value == &#39;true&#39; || value == &#39;1&#39;);
<a name="line783"></a>  }
<a name="line784"></a>};
<a name="line785"></a>
<a name="line786"></a>
<a name="line787"></a>
<a name="line788"></a>/**
<a name="line789"></a> * An entry in a BooleanGroup.
<a name="line790"></a> * @param {string} id The ID for the setting.
<a name="line791"></a> * @param {string} description A description of what the setting does.
<a name="line792"></a> * @param {!goog.tweak.BooleanGroup} group The group that this entry belongs
<a name="line793"></a> *     to.
<a name="line794"></a> * @constructor
<a name="line795"></a> * @extends {goog.tweak.BooleanSetting}
<a name="line796"></a> */
<a name="line797"></a>goog.tweak.BooleanInGroupSetting = function(id, description, group) {
<a name="line798"></a>  goog.tweak.BooleanSetting.call(this, id, description);
<a name="line799"></a>
<a name="line800"></a>  /**
<a name="line801"></a>   * The token to use in the query parameter.
<a name="line802"></a>   * @type {string}
<a name="line803"></a>   * @private
<a name="line804"></a>   */
<a name="line805"></a>  this.token_ = this.getId().toLowerCase();
<a name="line806"></a>
<a name="line807"></a>  /**
<a name="line808"></a>   * The BooleanGroup that this setting belongs to.
<a name="line809"></a>   * @type {!goog.tweak.BooleanGroup}
<a name="line810"></a>   * @private
<a name="line811"></a>   */
<a name="line812"></a>  this.group_ = group;
<a name="line813"></a>
<a name="line814"></a>  // Take setting out of top-level query parameter list.
<a name="line815"></a>  goog.tweak.BooleanInGroupSetting.superClass_.setParamName.call(this,
<a name="line816"></a>      null);
<a name="line817"></a>};
<a name="line818"></a>goog.inherits(goog.tweak.BooleanInGroupSetting, goog.tweak.BooleanSetting);
<a name="line819"></a>
<a name="line820"></a>
<a name="line821"></a>/**
<a name="line822"></a> * The logger for this class.
<a name="line823"></a> * @type {!goog.debug.Logger}
<a name="line824"></a> * @protected
<a name="line825"></a> * @override
<a name="line826"></a> */
<a name="line827"></a>goog.tweak.BooleanInGroupSetting.prototype.logger =
<a name="line828"></a>    goog.debug.Logger.getLogger(&#39;goog.tweak.BooleanInGroupSetting&#39;);
<a name="line829"></a>
<a name="line830"></a>
<a name="line831"></a>/**
<a name="line832"></a> * @override
<a name="line833"></a> */
<a name="line834"></a>goog.tweak.BooleanInGroupSetting.prototype.setParamName = function(value) {
<a name="line835"></a>  goog.asserts.fail(&#39;Use setToken() for BooleanInGroupSetting.&#39;);
<a name="line836"></a>};
<a name="line837"></a>
<a name="line838"></a>
<a name="line839"></a>/**
<a name="line840"></a> * Sets the token to use in the query parameter.
<a name="line841"></a> * @param {string} value The value.
<a name="line842"></a> */
<a name="line843"></a>goog.tweak.BooleanInGroupSetting.prototype.setToken = function(value) {
<a name="line844"></a>  this.token_ = value;
<a name="line845"></a>};
<a name="line846"></a>
<a name="line847"></a>
<a name="line848"></a>/**
<a name="line849"></a> * Returns the token to use in the query parameter.
<a name="line850"></a> * @return {string} The value.
<a name="line851"></a> */
<a name="line852"></a>goog.tweak.BooleanInGroupSetting.prototype.getToken = function() {
<a name="line853"></a>  return this.token_;
<a name="line854"></a>};
<a name="line855"></a>
<a name="line856"></a>
<a name="line857"></a>/**
<a name="line858"></a> * Returns the BooleanGroup that this setting belongs to.
<a name="line859"></a> * @return {!goog.tweak.BooleanGroup} The BooleanGroup that this setting
<a name="line860"></a> *     belongs to.
<a name="line861"></a> */
<a name="line862"></a>goog.tweak.BooleanInGroupSetting.prototype.getGroup = function() {
<a name="line863"></a>  return this.group_;
<a name="line864"></a>};
<a name="line865"></a>
<a name="line866"></a>
<a name="line867"></a>
<a name="line868"></a>/**
<a name="line869"></a> * A registry setting that contains a group of boolean subfield, where all
<a name="line870"></a> * entries modify the same query parameter. For example:
<a name="line871"></a> *     ?foo=setting1,-setting2
<a name="line872"></a> * @param {string} id The ID for the setting.
<a name="line873"></a> * @param {string} description A description of what the setting does.
<a name="line874"></a> * @constructor
<a name="line875"></a> * @extends {goog.tweak.BaseSetting}
<a name="line876"></a> */
<a name="line877"></a>goog.tweak.BooleanGroup = function(id, description) {
<a name="line878"></a>  goog.tweak.BaseSetting.call(this, id, description);
<a name="line879"></a>
<a name="line880"></a>  /**
<a name="line881"></a>   * A map of token-&gt;child entry.
<a name="line882"></a>   * @type {!Object.&lt;!goog.tweak.BooleanSetting&gt;}
<a name="line883"></a>   * @private
<a name="line884"></a>   */
<a name="line885"></a>  this.entriesByToken_ = {};
<a name="line886"></a>
<a name="line887"></a>
<a name="line888"></a>  /**
<a name="line889"></a>   * A map of token-&gt;true/false for all tokens that appeared in the query
<a name="line890"></a>   * parameter.
<a name="line891"></a>   * @type {!Object.&lt;boolean&gt;}
<a name="line892"></a>   * @private
<a name="line893"></a>   */
<a name="line894"></a>  this.queryParamValues_ = {};
<a name="line895"></a>
<a name="line896"></a>};
<a name="line897"></a>goog.inherits(goog.tweak.BooleanGroup, goog.tweak.BaseSetting);
<a name="line898"></a>
<a name="line899"></a>
<a name="line900"></a>/**
<a name="line901"></a> * The logger for this class.
<a name="line902"></a> * @type {!goog.debug.Logger}
<a name="line903"></a> * @protected
<a name="line904"></a> * @override
<a name="line905"></a> */
<a name="line906"></a>goog.tweak.BooleanGroup.prototype.logger =
<a name="line907"></a>    goog.debug.Logger.getLogger(&#39;goog.tweak.BooleanGroup&#39;);
<a name="line908"></a>
<a name="line909"></a>
<a name="line910"></a>/**
<a name="line911"></a> * Returns the map of token-&gt;boolean settings.
<a name="line912"></a> * @return {!Object.&lt;!goog.tweak.BooleanSetting&gt;} The child settings.
<a name="line913"></a> */
<a name="line914"></a>goog.tweak.BooleanGroup.prototype.getChildEntries = function() {
<a name="line915"></a>  return this.entriesByToken_;
<a name="line916"></a>};
<a name="line917"></a>
<a name="line918"></a>
<a name="line919"></a>/**
<a name="line920"></a> * Adds the given BooleanSetting to the group.
<a name="line921"></a> * @param {goog.tweak.BooleanInGroupSetting} boolEntry The entry.
<a name="line922"></a> */
<a name="line923"></a>goog.tweak.BooleanGroup.prototype.addChild = function(boolEntry) {
<a name="line924"></a>  this.ensureInitialized();
<a name="line925"></a>
<a name="line926"></a>  var token = boolEntry.getToken();
<a name="line927"></a>  var lcToken = token.toLowerCase();
<a name="line928"></a>  goog.asserts.assert(!this.entriesByToken_[lcToken],
<a name="line929"></a>      &#39;Multiple bools registered with token &quot;%s&quot; in group: %s&#39;, token,
<a name="line930"></a>      this.getId());
<a name="line931"></a>  this.entriesByToken_[lcToken] = boolEntry;
<a name="line932"></a>
<a name="line933"></a>  // Initialize from query param.
<a name="line934"></a>  var value = this.queryParamValues_[lcToken];
<a name="line935"></a>  if (value != undefined) {
<a name="line936"></a>    boolEntry.initialQueryParamValue = value ? &#39;1&#39; : &#39;0&#39;;
<a name="line937"></a>  }
<a name="line938"></a>};
<a name="line939"></a>
<a name="line940"></a>
<a name="line941"></a>/**
<a name="line942"></a> * @override
<a name="line943"></a> */
<a name="line944"></a>goog.tweak.BooleanGroup.prototype.initialize = function(value) {
<a name="line945"></a>  var queryParamValues = {};
<a name="line946"></a>
<a name="line947"></a>  if (value) {
<a name="line948"></a>    var tokens = value.split(/\s*,\s*/);
<a name="line949"></a>    for (var i = 0; i &lt; tokens.length; ++i) {
<a name="line950"></a>      var token = tokens[i].toLowerCase();
<a name="line951"></a>      var negative = token.charAt(0) == &#39;-&#39;;
<a name="line952"></a>      if (negative) {
<a name="line953"></a>        token = token.substr(1);
<a name="line954"></a>      }
<a name="line955"></a>      queryParamValues[token] = !negative;
<a name="line956"></a>    }
<a name="line957"></a>  }
<a name="line958"></a>  this.queryParamValues_ = queryParamValues;
<a name="line959"></a>};
<a name="line960"></a>
<a name="line961"></a>
<a name="line962"></a>/**
<a name="line963"></a> * @override
<a name="line964"></a> */
<a name="line965"></a>goog.tweak.BooleanGroup.prototype.getNewValueEncoded = function() {
<a name="line966"></a>  this.ensureInitialized();
<a name="line967"></a>  var nonDefaultValues = [];
<a name="line968"></a>  // Sort the keys so that the generate value is stable.
<a name="line969"></a>  var keys = goog.object.getKeys(this.entriesByToken_);
<a name="line970"></a>  keys.sort();
<a name="line971"></a>  for (var i = 0, entry; entry = this.entriesByToken_[keys[i]]; ++i) {
<a name="line972"></a>    var encodedValue = entry.getNewValueEncoded();
<a name="line973"></a>    if (encodedValue != null) {
<a name="line974"></a>      nonDefaultValues.push((entry.getNewValue() ? &#39;&#39; : &#39;-&#39;) +
<a name="line975"></a>          entry.getToken());
<a name="line976"></a>    }
<a name="line977"></a>  }
<a name="line978"></a>  return nonDefaultValues.length ? nonDefaultValues.join(&#39;,&#39;) : null;
<a name="line979"></a>};
<a name="line980"></a>
<a name="line981"></a>
<a name="line982"></a>
<a name="line983"></a>/**
<a name="line984"></a> * A registry action (a button).
<a name="line985"></a> * @param {string} id The ID for the setting.
<a name="line986"></a> * @param {string} description A description of what the setting does.
<a name="line987"></a> * @param {!Function} callback Function to call when the button is clicked.
<a name="line988"></a> * @constructor
<a name="line989"></a> * @extends {goog.tweak.BaseEntry}
<a name="line990"></a> */
<a name="line991"></a>goog.tweak.ButtonAction = function(id, description, callback) {
<a name="line992"></a>  goog.tweak.BaseEntry.call(this, id, description);
<a name="line993"></a>  this.addCallback(callback);
<a name="line994"></a>  this.setRestartRequired(false);
<a name="line995"></a>};
<a name="line996"></a>goog.inherits(goog.tweak.ButtonAction, goog.tweak.BaseEntry);
</pre>


</body>
</html>
